<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
    
  </style>
</head>
<body>
  
</body>
<script>

  const target = {
    name:"target",
    age:19,
    sex:"男"
  }

  const obj = {};

  for(let i in target){
    Object.defineProperty(obj, i, {
      get(){
        console.log(`obj的${i}属性被访问了`);
        return target[i];
      },
      set(val){
        console.log(`obj的${i}属性被修改成了`, val);
        target[i] = val;
      }
    })
  }

  // 问题：劫持之后，添加的属性，不是响应式属性（不具备访问器和控制器）
  target.msg = "hello target";
  obj.msg = "hello obj";

  console.log(obj);

</script>
</html>